package com.elitesland.system.repo;

import com.elitesland.system.entity.SysPermissionDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * <pre>
 * 系统权限表JPA+QueryDSL访问封装
 * </pre>
 *
 * @author Mir
 * @date 2020/6/15
 */
@Repository
public interface SysPermissionRepo extends JpaRepository<SysPermissionDO, Long>, QuerydslPredicateExecutor<SysPermissionDO> {

    List<SysPermissionDO> findAllByIdIn(List<Long> ids);

    List<SysPermissionDO> findAllByParentIdAndPermType(Long id, Integer permType);

    Optional<SysPermissionDO> findByCode(String code);

    List<SysPermissionDO> findByPathLike(String pathPrefix);
}
